package com.Modular.MinioPlugin;

import com.jfinal.kit.StrKit;
import com.jfinal.plugin.IPlugin;

/**miniio整合插件
 * @author Administrator
 *
 */
public class MinIoPlugin implements IPlugin {
	
	
	protected static String endpoint ;//路径
	protected static String accessKey ;//账号
	protected static String secretKey ;//密码
	
	
	/**构造方法
	 * @param endpoint 路径
	 * @param accessKey 账号
	 * @param secretKey 密码
	 */
	public MinIoPlugin(String endpoint ,String accessKey, String secretKey) {
		if (StrKit.isBlank(endpoint)) {
			throw new IllegalArgumentException("endpoint can not be blank");
		}
		if (StrKit.isBlank(accessKey)) {
			throw new IllegalArgumentException("accessKey can not be blank");
		}
		if (StrKit.isBlank(secretKey)) {
			throw new IllegalArgumentException("secretKey can not be blank");
		}
		MinIoPlugin.endpoint = endpoint;
		MinIoPlugin.accessKey = accessKey;
		MinIoPlugin.secretKey = secretKey;
		
	}
	

	@Override
	public boolean start() {
		MinIoOperations.addMainIo(endpoint ,accessKey ,secretKey );
		return true;
	}

	@Override
	public boolean stop() {
		// TODO Auto-generated method stub
		return true;
	}

}
